package com.android.tiango.baba.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

import com.android.tiango.baba.entity.SimpleTopicModel;
import com.android.tiango.baba.entity.UserTagModel;

public class UserTagUtil {
	private static  ArrayList<UserTagModel> datas;
	@SuppressWarnings("unchecked")
	public static ArrayList<UserTagModel> shortUserTagData(ArrayList<UserTagModel> data) {
		datas = new ArrayList<UserTagModel>();
//		Comparator comparator = new MyComparator();
//		Collections.sort(data, comparator);
//		System.out.println(data);
		for (int i = 0; i < data.size(); i++) {
			UserTagModel lhs = data.get(i);
			if(lhs.getIsActivated() == 1){
				datas.add(lhs);
			}
		}
		for (int i = 0; i < data.size(); i++) {
			UserTagModel lhs = data.get(i);
			if(lhs.getIsActivated() != 1){
				datas.add(lhs);
			}
		}
		return datas;
	}
}

	class MyComparator implements Comparator<UserTagModel> {
		@Override
		public int compare(UserTagModel lhs, UserTagModel rhs) {
			int bar1 = lhs.getIsActivated();
			int bar2 = rhs.getIsActivated();
			// 根据是否已激活
			if (bar1 > bar2) {
				return 0;
			} else if (bar1 <= bar2) {
				return 1;
			}
			return -1; 
		} 
		
	}
